1. Field of the Invention
The present invention relates to a portable data-recording medium, generally known as an "IC card", which contains an IC chip having, for example, a non-volatile data memory and a control element such as a CPU, and more particularly, to a system for storing data in the data memory.
2. Description of the related art including information disclosed under .sctn..sctn.1.97-1.99.
The so-called "IC card" was developed recently and contains an IC chip having a non-volatile data memory and a control element such as a CPU. The control element controls access to the data memory, storing data in and reading it out from the data memory, in accordance with a command input via an external terminal device. The storage area of the data memory is divided into a plurality of smaller areas, any of which can be accessed, as required, by the control element.
In the data memory of the conventional IC card, items of data are sequentially stored in the order in which they will be accessed. To replace one of the data items stored in the memory with an other data item, it is necessary for the other data item to be the same length as the data item already stored therein. If the data item being replaced is of greater length than the replacement data item, memory elements capable of storing several bytes (or several words) will remain unused after the replacement data item has been stored. Conversely, if the data item being replaced is shorter in length than the replacement data item, the next data item stored in the memory must be shifted within the memory to ensure that the replacement data item does not overflow.
In order to reduce the number of unused memory elements to a minimum, and to prevent the overflowing of data items, each data item is divided into a plurality of words, thus forming a chain of words, to which so-called chain data is added, one chain data item to each word. By storing these words sequentially in the data memory, there is much less probability that some memory elements will remain unused, or that a newly-entered data item will overflow.
In order to distinguish one word chain (or data item) from any other word chains (or other data items), it is necessary for the first and last word of each word chain to be clearly identifiable. (However, there is, as yet, no known data storing system which is capable of identifying the first or last word of a word chain.)
A chain data item is added to each word as the word chain is stored in the data memory. If, as a result of some external disturbance, the power supply to the IC card is cut off before all the necessary word chain (or data item) have been stored in the data memory, one of the chain data items added to word chains is cut. Consequently, if the control element of the IC card later accesses the memory, in order to read out the word to which the incomplete chain data is added, another, different, word may erroneously be read out from the data memory.